package com.itheima.sh.mapper.impl;

import com.itheima.sh.mapper.Tb_skuMapper;
import com.itheima.sh.pojo.tb_sku;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class Tb_skuMapperimpl implements Tb_skuMapper {

    //注入 jdbcTempalte
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public List<tb_sku> findALLsku() {
       //1.创建sql语句
        String sql="select * from tb_sku";
       //2.调用方法查询
        List<tb_sku> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<tb_sku>(tb_sku.class));

        return query;
    }
}
